# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>

pkgbase=snowball
pkgname=(snowball libstemmer)
pkgver=0+337
pkgrel=2
pkgdesc="String processing language for creating stemming algorithms"
arch=(i686 x86_64)
url="http://snowballstem.org/"
license=(BSD)
depends=(glibc)
makedepends=(git)
_commit=fc2adaa96b0561506e6c1a80d73de7f4e0fa9663
source=("git+https://github.com/snowballstem/snowball#commit=$_commit"
        dynamiclib.patch)
sha256sums=('SKIP'
            '99511a11cdeeb1ef1eaa9d7b777f6934693d4696ba9523de40b886f7d898058e')

prepare() {
  cd $pkgbase
  patch -Np1 -i ../dynamiclib.patch
}

pkgver() {
  cd $pkgbase
  echo "0+$(git rev-list --count HEAD)"
}

build() {
  cd $pkgbase
  make
}

check() {
  cd $pkgbase
  # Disabled - needs external test data
  #make check
}

package_snowball() {
  cd $pkgbase
  install -d "$pkgdir/usr/bin"
  install -t "$pkgdir/usr/bin" snowball stemwords
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/snowball/LICENSE"
}

package_libstemmer() {
  pkgdesc="Stemming library supporting several languages"
  cd $pkgbase
  install -Dm644 {.,"$pkgdir"/usr}/include/libstemmer.h
  install -D {.,"$pkgdir"/usr/lib}/libstemmer.so.0.0.0
  ln -s libstemmer.so.0.0.0 "$pkgdir/usr/lib/libstemmer.so.0"
  ln -s libstemmer.so.0 "$pkgdir/usr/lib/libstemmer.so"
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/libstemmer/LICENSE"
}
